﻿using Microsoft.Extensions.Options;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _2Net8Configuration.Applications
{
    /// <summary>
    /// 商品Service
    /// </summary>
    public class ProductServices
    {
        // 配置对象
        public ProductServiceSettings _Settings { get; set; }

        public ProductServices(IOptions<ProductServiceSettings> settings)
        {
            _Settings = settings.Value;
        }
        public void GetProduct()
        {
            // 使用配置对象
            if (_Settings.SeclectType)
            {
                Console.WriteLine("从MySQL中查询商品数据");
            }
            else
            {
                Console.WriteLine("从Redis中查询商品数据");
            }     
        }
    }
}
